package cn.itcast.com.Thread;

public class ComsumerTsk implements Runnable{

    private Container container;

    public ComsumerTsk(Container container) {
        this.container = container;
    }

    @Override
    public void run() {
        //判断蒸笼状态
        //如果蒸笼为空，克制自己
        while (true){
            synchronized (container){
                if (container.isEmpty()){
                    try {
                        container.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                else {
                    container.eatFodd();
                    container.notify();
                }
            }
        }


    }
}
